{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "9c175dbb-b163-49d8-97ac-fcdae5776322",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Code source: Jaques Grobler\n",
    "# License: BSD 3 clause\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "from sklearn import datasets, linear_model\n",
    "from sklearn.metrics import mean_squared_error, r2_score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "86369afc-8ee3-4e67-a999-d56c15a05cf9",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# Load the diabetes dataset\n",
    "diabetes_X, diabetes_y = datasets.load_diabetes(return_X_y=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "3b2941fa-d518-4849-be40-d8fe9f739126",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "outputs_hidden": true
    },
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 0.06169621]\n",
      " [-0.05147406]\n",
      " [ 0.04445121]\n",
      " [-0.01159501]\n",
      " [-0.03638469]\n",
      " [-0.04069594]\n",
      " [-0.04716281]\n",
      " [-0.00189471]\n",
      " [ 0.06169621]\n",
      " [ 0.03906215]\n",
      " [-0.08380842]\n",
      " [ 0.01750591]\n",
      " [-0.02884001]\n",
      " [-0.00189471]\n",
      " [-0.02560657]\n",
      " [-0.01806189]\n",
      " [ 0.04229559]\n",
      " [ 0.01211685]\n",
      " [-0.0105172 ]\n",
      " [-0.01806189]\n",
      " [-0.05686312]\n",
      " [-0.02237314]\n",
      " [-0.00405033]\n",
      " [ 0.06061839]\n",
      " [ 0.03582872]\n",
      " [-0.01267283]\n",
      " [-0.07734155]\n",
      " [ 0.05954058]\n",
      " [-0.02129532]\n",
      " [-0.00620595]\n",
      " [ 0.04445121]\n",
      " [-0.06548562]\n",
      " [ 0.12528712]\n",
      " [-0.05039625]\n",
      " [-0.06332999]\n",
      " [-0.03099563]\n",
      " [ 0.02289497]\n",
      " [ 0.01103904]\n",
      " [ 0.07139652]\n",
      " [ 0.01427248]\n",
      " [-0.00836158]\n",
      " [-0.06764124]\n",
      " [-0.0105172 ]\n",
      " [-0.02345095]\n",
      " [ 0.06816308]\n",
      " [-0.03530688]\n",
      " [-0.01159501]\n",
      " [-0.0730303 ]\n",
      " [-0.04177375]\n",
      " [ 0.01427248]\n",
      " [-0.00728377]\n",
      " [ 0.0164281 ]\n",
      " [-0.00943939]\n",
      " [-0.01590626]\n",
      " [ 0.0250506 ]\n",
      " [-0.04931844]\n",
      " [ 0.04121778]\n",
      " [-0.06332999]\n",
      " [-0.06440781]\n",
      " [-0.02560657]\n",
      " [-0.00405033]\n",
      " [ 0.00457217]\n",
      " [-0.00728377]\n",
      " [-0.0374625 ]\n",
      " [-0.02560657]\n",
      " [-0.02452876]\n",
      " [-0.01806189]\n",
      " [-0.01482845]\n",
      " [-0.02991782]\n",
      " [-0.046085  ]\n",
      " [-0.06979687]\n",
      " [ 0.03367309]\n",
      " [-0.00405033]\n",
      " [-0.02021751]\n",
      " [ 0.00241654]\n",
      " [-0.03099563]\n",
      " [ 0.02828403]\n",
      " [-0.03638469]\n",
      " [-0.05794093]\n",
      " [-0.0374625 ]\n",
      " [ 0.01211685]\n",
      " [-0.02237314]\n",
      " [-0.03530688]\n",
      " [ 0.00996123]\n",
      " [-0.03961813]\n",
      " [ 0.07139652]\n",
      " [-0.07518593]\n",
      " [-0.00620595]\n",
      " [-0.04069594]\n",
      " [-0.04824063]\n",
      " [-0.02560657]\n",
      " [ 0.0519959 ]\n",
      " [ 0.00457217]\n",
      " [-0.06440781]\n",
      " [-0.01698407]\n",
      " [-0.05794093]\n",
      " [ 0.00996123]\n",
      " [ 0.08864151]\n",
      " [-0.00512814]\n",
      " [-0.06440781]\n",
      " [ 0.01750591]\n",
      " [-0.04500719]\n",
      " [ 0.02828403]\n",
      " [ 0.04121778]\n",
      " [ 0.06492964]\n",
      " [-0.03207344]\n",
      " [-0.07626374]\n",
      " [ 0.04984027]\n",
      " [ 0.04552903]\n",
      " [-0.00943939]\n",
      " [-0.03207344]\n",
      " [ 0.00457217]\n",
      " [ 0.02073935]\n",
      " [ 0.01427248]\n",
      " [ 0.11019775]\n",
      " [ 0.00133873]\n",
      " [ 0.05846277]\n",
      " [-0.02129532]\n",
      " [-0.0105172 ]\n",
      " [-0.04716281]\n",
      " [ 0.00457217]\n",
      " [ 0.01750591]\n",
      " [ 0.08109682]\n",
      " [ 0.0347509 ]\n",
      " [ 0.02397278]\n",
      " [-0.00836158]\n",
      " [-0.06117437]\n",
      " [-0.00189471]\n",
      " [-0.06225218]\n",
      " [ 0.0164281 ]\n",
      " [ 0.09618619]\n",
      " [-0.06979687]\n",
      " [-0.02129532]\n",
      " [-0.05362969]\n",
      " [ 0.0433734 ]\n",
      " [ 0.05630715]\n",
      " [-0.0816528 ]\n",
      " [ 0.04984027]\n",
      " [ 0.11127556]\n",
      " [ 0.06169621]\n",
      " [ 0.01427248]\n",
      " [ 0.04768465]\n",
      " [ 0.01211685]\n",
      " [ 0.00564998]\n",
      " [ 0.04660684]\n",
      " [ 0.12852056]\n",
      " [ 0.05954058]\n",
      " [ 0.09295276]\n",
      " [ 0.01535029]\n",
      " [-0.00512814]\n",
      " [ 0.0703187 ]\n",
      " [-0.00405033]\n",
      " [-0.00081689]\n",
      " [-0.04392938]\n",
      " [ 0.02073935]\n",
      " [ 0.06061839]\n",
      " [-0.0105172 ]\n",
      " [-0.03315126]\n",
      " [-0.06548562]\n",
      " [ 0.0433734 ]\n",
      " [-0.06225218]\n",
      " [ 0.06385183]\n",
      " [ 0.03043966]\n",
      " [ 0.07247433]\n",
      " [-0.0191397 ]\n",
      " [-0.06656343]\n",
      " [-0.06009656]\n",
      " [ 0.06924089]\n",
      " [ 0.05954058]\n",
      " [-0.02668438]\n",
      " [-0.02021751]\n",
      " [-0.046085  ]\n",
      " [ 0.07139652]\n",
      " [-0.07949718]\n",
      " [ 0.00996123]\n",
      " [-0.03854032]\n",
      " [ 0.01966154]\n",
      " [ 0.02720622]\n",
      " [-0.00836158]\n",
      " [-0.01590626]\n",
      " [ 0.00457217]\n",
      " [-0.04285156]\n",
      " [ 0.00564998]\n",
      " [-0.03530688]\n",
      " [ 0.02397278]\n",
      " [-0.01806189]\n",
      " [ 0.04229559]\n",
      " [-0.0547075 ]\n",
      " [-0.00297252]\n",
      " [-0.06656343]\n",
      " [-0.01267283]\n",
      " [-0.04177375]\n",
      " [-0.03099563]\n",
      " [-0.00512814]\n",
      " [-0.05901875]\n",
      " [ 0.0250506 ]\n",
      " [-0.046085  ]\n",
      " [ 0.00349435]\n",
      " [ 0.05415152]\n",
      " [-0.04500719]\n",
      " [-0.05794093]\n",
      " [-0.05578531]\n",
      " [ 0.00133873]\n",
      " [ 0.03043966]\n",
      " [ 0.00672779]\n",
      " [ 0.04660684]\n",
      " [ 0.02612841]\n",
      " [ 0.04552903]\n",
      " [ 0.04013997]\n",
      " [-0.01806189]\n",
      " [ 0.01427248]\n",
      " [ 0.03690653]\n",
      " [ 0.00349435]\n",
      " [-0.07087468]\n",
      " [-0.03315126]\n",
      " [ 0.09403057]\n",
      " [ 0.03582872]\n",
      " [ 0.03151747]\n",
      " [-0.06548562]\n",
      " [-0.04177375]\n",
      " [-0.03961813]\n",
      " [-0.03854032]\n",
      " [-0.02560657]\n",
      " [-0.02345095]\n",
      " [-0.06656343]\n",
      " [ 0.03259528]\n",
      " [-0.046085  ]\n",
      " [-0.02991782]\n",
      " [-0.01267283]\n",
      " [-0.01590626]\n",
      " [ 0.07139652]\n",
      " [-0.03099563]\n",
      " [ 0.00026092]\n",
      " [ 0.03690653]\n",
      " [ 0.03906215]\n",
      " [-0.01482845]\n",
      " [ 0.00672779]\n",
      " [-0.06871905]\n",
      " [-0.00943939]\n",
      " [ 0.01966154]\n",
      " [ 0.07462995]\n",
      " [-0.00836158]\n",
      " [-0.02345095]\n",
      " [-0.046085  ]\n",
      " [ 0.05415152]\n",
      " [-0.03530688]\n",
      " [-0.03207344]\n",
      " [-0.0816528 ]\n",
      " [ 0.04768465]\n",
      " [ 0.06061839]\n",
      " [ 0.05630715]\n",
      " [ 0.09834182]\n",
      " [ 0.05954058]\n",
      " [ 0.03367309]\n",
      " [ 0.05630715]\n",
      " [-0.06548562]\n",
      " [ 0.16085492]\n",
      " [-0.05578531]\n",
      " [-0.02452876]\n",
      " [-0.03638469]\n",
      " [-0.00836158]\n",
      " [-0.04177375]\n",
      " [ 0.12744274]\n",
      " [-0.07734155]\n",
      " [ 0.02828403]\n",
      " [-0.02560657]\n",
      " [-0.06225218]\n",
      " [-0.00081689]\n",
      " [ 0.08864151]\n",
      " [-0.03207344]\n",
      " [ 0.03043966]\n",
      " [ 0.00888341]\n",
      " [ 0.00672779]\n",
      " [-0.02021751]\n",
      " [-0.02452876]\n",
      " [-0.01159501]\n",
      " [ 0.02612841]\n",
      " [-0.05901875]\n",
      " [-0.03638469]\n",
      " [-0.02452876]\n",
      " [ 0.01858372]\n",
      " [-0.0902753 ]\n",
      " [-0.00512814]\n",
      " [-0.05255187]\n",
      " [-0.02237314]\n",
      " [-0.02021751]\n",
      " [-0.0547075 ]\n",
      " [-0.00620595]\n",
      " [-0.01698407]\n",
      " [ 0.05522933]\n",
      " [ 0.07678558]\n",
      " [ 0.01858372]\n",
      " [-0.02237314]\n",
      " [ 0.09295276]\n",
      " [-0.03099563]\n",
      " [ 0.03906215]\n",
      " [-0.06117437]\n",
      " [-0.00836158]\n",
      " [-0.0374625 ]\n",
      " [-0.01375064]\n",
      " [ 0.07355214]\n",
      " [-0.02452876]\n",
      " [ 0.03367309]\n",
      " [ 0.0347509 ]\n",
      " [-0.03854032]\n",
      " [-0.03961813]\n",
      " [-0.00189471]\n",
      " [-0.03099563]\n",
      " [-0.046085  ]\n",
      " [ 0.00133873]\n",
      " [ 0.06492964]\n",
      " [ 0.04013997]\n",
      " [-0.02345095]\n",
      " [ 0.05307371]\n",
      " [ 0.04013997]\n",
      " [-0.02021751]\n",
      " [ 0.01427248]\n",
      " [-0.03422907]\n",
      " [ 0.00672779]\n",
      " [ 0.00457217]\n",
      " [ 0.03043966]\n",
      " [ 0.0519959 ]\n",
      " [ 0.06169621]\n",
      " [-0.00728377]\n",
      " [ 0.00564998]\n",
      " [ 0.05415152]\n",
      " [-0.00836158]\n",
      " [ 0.114509  ]\n",
      " [ 0.06708527]\n",
      " [-0.05578531]\n",
      " [ 0.03043966]\n",
      " [-0.02560657]\n",
      " [ 0.10480869]\n",
      " [-0.00620595]\n",
      " [-0.04716281]\n",
      " [-0.04824063]\n",
      " [ 0.08540807]\n",
      " [-0.01267283]\n",
      " [-0.03315126]\n",
      " [-0.00728377]\n",
      " [-0.01375064]\n",
      " [ 0.05954058]\n",
      " [ 0.02181716]\n",
      " [ 0.01858372]\n",
      " [-0.01159501]\n",
      " [-0.00297252]\n",
      " [ 0.01750591]\n",
      " [-0.02991782]\n",
      " [-0.02021751]\n",
      " [-0.05794093]\n",
      " [ 0.06061839]\n",
      " [-0.04069594]\n",
      " [-0.07195249]\n",
      " [-0.05578531]\n",
      " [ 0.04552903]\n",
      " [-0.00943939]\n",
      " [-0.03315126]\n",
      " [ 0.04984027]\n",
      " [-0.08488624]\n",
      " [ 0.00564998]\n",
      " [ 0.02073935]\n",
      " [-0.00728377]\n",
      " [ 0.10480869]\n",
      " [-0.02452876]\n",
      " [-0.00620595]\n",
      " [-0.03854032]\n",
      " [ 0.13714305]\n",
      " [ 0.17055523]\n",
      " [ 0.00241654]\n",
      " [ 0.03798434]\n",
      " [-0.05794093]\n",
      " [-0.00943939]\n",
      " [-0.02345095]\n",
      " [-0.0105172 ]\n",
      " [-0.03422907]\n",
      " [-0.00297252]\n",
      " [ 0.06816308]\n",
      " [ 0.00996123]\n",
      " [ 0.00241654]\n",
      " [-0.03854032]\n",
      " [ 0.02612841]\n",
      " [-0.08919748]\n",
      " [ 0.06061839]\n",
      " [-0.02884001]\n",
      " [-0.02991782]\n",
      " [-0.0191397 ]\n",
      " [-0.04069594]\n",
      " [ 0.01535029]\n",
      " [-0.02452876]\n",
      " [ 0.00133873]\n",
      " [ 0.06924089]\n",
      " [-0.06979687]\n",
      " [-0.02991782]\n",
      " [-0.046085  ]\n",
      " [ 0.01858372]\n",
      " [ 0.00133873]\n",
      " [-0.03099563]\n",
      " [-0.00405033]\n",
      " [ 0.01535029]\n",
      " [ 0.02289497]\n",
      " [ 0.04552903]\n",
      " [-0.04500719]\n",
      " [-0.03315126]\n",
      " [ 0.097264  ]\n",
      " [ 0.05415152]\n",
      " [ 0.12313149]\n",
      " [-0.08057499]\n",
      " [ 0.09295276]\n",
      " [-0.05039625]\n",
      " [-0.01159501]\n",
      " [-0.0277622 ]\n",
      " [ 0.05846277]\n",
      " [ 0.08540807]\n",
      " [-0.00081689]\n",
      " [ 0.00672779]\n",
      " [ 0.00888341]\n",
      " [ 0.08001901]\n",
      " [ 0.07139652]\n",
      " [-0.02452876]\n",
      " [-0.0547075 ]\n",
      " [-0.03638469]\n",
      " [ 0.0164281 ]\n",
      " [ 0.07786339]\n",
      " [-0.03961813]\n",
      " [ 0.01103904]\n",
      " [-0.04069594]\n",
      " [-0.03422907]\n",
      " [ 0.00564998]\n",
      " [ 0.08864151]\n",
      " [-0.03315126]\n",
      " [-0.05686312]\n",
      " [-0.03099563]\n",
      " [ 0.05522933]\n",
      " [-0.06009656]\n",
      " [ 0.00133873]\n",
      " [-0.02345095]\n",
      " [-0.07410811]\n",
      " [ 0.01966154]\n",
      " [-0.01590626]\n",
      " [-0.01590626]\n",
      " [ 0.03906215]\n",
      " [-0.0730303 ]]\n"
     ]
    }
   ],
   "source": [
    "print(diabetes_X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "9d263bcf-77be-4d82-845b-5c178d8cc2f4",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[151.  75. 141. 206. 135.  97. 138.  63. 110. 310. 101.  69. 179. 185.\n",
      " 118. 171. 166. 144.  97. 168.  68.  49.  68. 245. 184. 202. 137.  85.\n",
      " 131. 283. 129.  59. 341.  87.  65. 102. 265. 276. 252.  90. 100.  55.\n",
      "  61.  92. 259.  53. 190. 142.  75. 142. 155. 225.  59. 104. 182. 128.\n",
      "  52.  37. 170. 170.  61. 144.  52. 128.  71. 163. 150.  97. 160. 178.\n",
      "  48. 270. 202. 111.  85.  42. 170. 200. 252. 113. 143.  51.  52. 210.\n",
      "  65. 141.  55. 134.  42. 111.  98. 164.  48.  96.  90. 162. 150. 279.\n",
      "  92.  83. 128. 102. 302. 198.  95.  53. 134. 144. 232.  81. 104.  59.\n",
      " 246. 297. 258. 229. 275. 281. 179. 200. 200. 173. 180.  84. 121. 161.\n",
      "  99. 109. 115. 268. 274. 158. 107.  83. 103. 272.  85. 280. 336. 281.\n",
      " 118. 317. 235.  60. 174. 259. 178. 128.  96. 126. 288.  88. 292.  71.\n",
      " 197. 186.  25.  84.  96. 195.  53. 217. 172. 131. 214.  59.  70. 220.\n",
      " 268. 152.  47.  74. 295. 101. 151. 127. 237. 225.  81. 151. 107.  64.\n",
      " 138. 185. 265. 101. 137. 143. 141.  79. 292. 178.  91. 116.  86. 122.\n",
      "  72. 129. 142.  90. 158.  39. 196. 222. 277.  99. 196. 202. 155.  77.\n",
      " 191.  70.  73.  49.  65. 263. 248. 296. 214. 185.  78.  93. 252. 150.\n",
      "  77. 208.  77. 108. 160.  53. 220. 154. 259.  90. 246. 124.  67.  72.\n",
      " 257. 262. 275. 177.  71.  47. 187. 125.  78.  51. 258. 215. 303. 243.\n",
      "  91. 150. 310. 153. 346.  63.  89.  50.  39. 103. 308. 116. 145.  74.\n",
      "  45. 115. 264.  87. 202. 127. 182. 241.  66.  94. 283.  64. 102. 200.\n",
      " 265.  94. 230. 181. 156. 233.  60. 219.  80.  68. 332. 248.  84. 200.\n",
      "  55.  85.  89.  31. 129.  83. 275.  65. 198. 236. 253. 124.  44. 172.\n",
      " 114. 142. 109. 180. 144. 163. 147.  97. 220. 190. 109. 191. 122. 230.\n",
      " 242. 248. 249. 192. 131. 237.  78. 135. 244. 199. 270. 164.  72.  96.\n",
      " 306.  91. 214.  95. 216. 263. 178. 113. 200. 139. 139.  88. 148.  88.\n",
      " 243.  71.  77. 109. 272.  60.  54. 221.  90. 311. 281. 182. 321.  58.\n",
      " 262. 206. 233. 242. 123. 167.  63. 197.  71. 168. 140. 217. 121. 235.\n",
      " 245.  40.  52. 104. 132.  88.  69. 219.  72. 201. 110.  51. 277.  63.\n",
      " 118.  69. 273. 258.  43. 198. 242. 232. 175.  93. 168. 275. 293. 281.\n",
      "  72. 140. 189. 181. 209. 136. 261. 113. 131. 174. 257.  55.  84.  42.\n",
      " 146. 212. 233.  91. 111. 152. 120.  67. 310.  94. 183.  66. 173.  72.\n",
      "  49.  64.  48. 178. 104. 132. 220.  57.]\n"
     ]
    }
   ],
   "source": [
    "print(diabetes_y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "a5c67525-bf27-4239-afbc-4935d0d73188",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Use only one feature\n",
    "diabetes_X = diabetes_X[:, np.newaxis, 2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "ebbcf906-2637-425a-9798-20e254bace0f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Split the data into training/testing sets\n",
    "diabetes_X_train = diabetes_X[:-20]\n",
    "diabetes_X_test = diabetes_X[-20:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "a4785ecd-39e3-4ffe-93ea-e86acb019381",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Split the targets into training/testing sets\n",
    "diabetes_y_train = diabetes_y[:-20]\n",
    "diabetes_y_test = diabetes_y[-20:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "56f070ca-6df7-4389-9af2-9b8f98aa7849",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[151.  75. 141. 206. 135.  97. 138.  63. 110. 310. 101.  69. 179. 185.\n",
      " 118. 171. 166. 144.  97. 168.  68.  49.  68. 245. 184. 202. 137.  85.\n",
      " 131. 283. 129.  59. 341.  87.  65. 102. 265. 276. 252.  90. 100.  55.\n",
      "  61.  92. 259.  53. 190. 142.  75. 142. 155. 225.  59. 104. 182. 128.\n",
      "  52.  37. 170. 170.  61. 144.  52. 128.  71. 163. 150.  97. 160. 178.\n",
      "  48. 270. 202. 111.  85.  42. 170. 200. 252. 113. 143.  51.  52. 210.\n",
      "  65. 141.  55. 134.  42. 111.  98. 164.  48.  96.  90. 162. 150. 279.\n",
      "  92.  83. 128. 102. 302. 198.  95.  53. 134. 144. 232.  81. 104.  59.\n",
      " 246. 297. 258. 229. 275. 281. 179. 200. 200. 173. 180.  84. 121. 161.\n",
      "  99. 109. 115. 268. 274. 158. 107.  83. 103. 272.  85. 280. 336. 281.\n",
      " 118. 317. 235.  60. 174. 259. 178. 128.  96. 126. 288.  88. 292.  71.\n",
      " 197. 186.  25.  84.  96. 195.  53. 217. 172. 131. 214.  59.  70. 220.\n",
      " 268. 152.  47.  74. 295. 101. 151. 127. 237. 225.  81. 151. 107.  64.\n",
      " 138. 185. 265. 101. 137. 143. 141.  79. 292. 178.  91. 116.  86. 122.\n",
      "  72. 129. 142.  90. 158.  39. 196. 222. 277.  99. 196. 202. 155.  77.\n",
      " 191.  70.  73.  49.  65. 263. 248. 296. 214. 185.  78.  93. 252. 150.\n",
      "  77. 208.  77. 108. 160.  53. 220. 154. 259.  90. 246. 124.  67.  72.\n",
      " 257. 262. 275. 177.  71.  47. 187. 125.  78.  51. 258. 215. 303. 243.\n",
      "  91. 150. 310. 153. 346.  63.  89.  50.  39. 103. 308. 116. 145.  74.\n",
      "  45. 115. 264.  87. 202. 127. 182. 241.  66.  94. 283.  64. 102. 200.\n",
      " 265.  94. 230. 181. 156. 233.  60. 219.  80.  68. 332. 248.  84. 200.\n",
      "  55.  85.  89.  31. 129.  83. 275.  65. 198. 236. 253. 124.  44. 172.\n",
      " 114. 142. 109. 180. 144. 163. 147.  97. 220. 190. 109. 191. 122. 230.\n",
      " 242. 248. 249. 192. 131. 237.  78. 135. 244. 199. 270. 164.  72.  96.\n",
      " 306.  91. 214.  95. 216. 263. 178. 113. 200. 139. 139.  88. 148.  88.\n",
      " 243.  71.  77. 109. 272.  60.  54. 221.  90. 311. 281. 182. 321.  58.\n",
      " 262. 206. 233. 242. 123. 167.  63. 197.  71. 168. 140. 217. 121. 235.\n",
      " 245.  40.  52. 104. 132.  88.  69. 219.  72. 201. 110.  51. 277.  63.\n",
      " 118.  69. 273. 258.  43. 198. 242. 232. 175.  93. 168. 275. 293. 281.\n",
      "  72. 140. 189. 181. 209. 136. 261. 113. 131. 174. 257.  55.  84.  42.\n",
      " 146. 212.] \n",
      " [233.  91. 111. 152. 120.  67. 310.  94. 183.  66. 173.  72.  49.  64.\n",
      "  48. 178. 104. 132. 220.  57.]\n"
     ]
    }
   ],
   "source": [
    "print(diabetes_y_train, \"\\n\", diabetes_y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "c5e310c9-db97-40df-aac3-d07c3f9ac017",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Create linear regression object\n",
    "regr = linear_model.LinearRegression()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "09ec4cf3-4b30-44ea-a5b7-65a955b008a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LinearRegression()"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Train the model using the training sets\n",
    "regr.fit(diabetes_X_train, diabetes_y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "8f8565c1-0c39-42db-af67-145afa1b6d14",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Make predictions using the testing set\n",
    "diabetes_y_pred = regr.predict(diabetes_X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "8989984e-bbf8-4245-9897-a96d9a8cfe59",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Coefficients: \n",
      " [938.23786125]\n",
      "Mean squared error: 2548.07\n",
      "Coefficient of determination: 0.47\n"
     ]
    }
   ],
   "source": [
    "# The coefficients\n",
    "print('Coefficients: \\n', regr.coef_)\n",
    "# The mean squared error\n",
    "print('Mean squared error: %.2f'\n",
    "      % mean_squared_error(diabetes_y_test, diabetes_y_pred))\n",
    "# The coefficient of determination: 1 is perfect prediction\n",
    "print('Coefficient of determination: %.2f'\n",
    "      % r2_score(diabetes_y_test, diabetes_y_pred))"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "66dc3629-7f4e-49c0-865a-cd0729f3ba69",
   "metadata": {
    "tags": []
   },
   "source": [
    "# Plot outputs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6f20fb53-82ed-4f39-99c1-18245a839520",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAggAAAGKCAYAAABpbLktAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/NK7nSAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAfo0lEQVR4nO3df2wk5X3H8c/ccHcpcDalQLLnWXWvlyv5XX4pLSUbvASaHxClbLYitSJUiKqUVMWu0pKWpknVlBSlUept1YAiAYooOUiWuUIgIVTottkIkOhdA4EGyAUftdfbu0CD7QsJx42nfwx7PvuxzzO7M7uzu+/Xf17v4/2K5DwfP9/nh+X7vi8AAIBjbOh2AQAAIH0ICAAAwEBAAAAABgICAAAwEBAAAICBgAAAAAwEBAAAYCAgAAAAwwmtDlxcXNTs7Ky2bNkiy7LirAkAACTE930tLCxo69at2rBh7XmClgPC7Oysstls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ACkQ6oCAgfgAACQDqkKCByAAwBAOqQqIHCJDAAA6ZCqgMAlMgAApEOqAoLEATgAAKRB6s5BaOIAHCA6/t0AWE9P3sXALzegdZxACiBOqWkxuK6rXC6nQqGgsbExFQoF5XI5ua7b7dKA1GueQLryHJF6va5SqcS/IwCRpaLFwPHKQOua11+vdcgY118DOFbPHLXM8cpAeziBFEASuh4Q+OUGtIcTSAEkoesBgV9uQHs4gRRAEroeEPjlBrSHE0gBJKHrAYFfbkB7OIEUQBK6HhD45Qa0jxNIAcQtFdscpdUPeclms5qcnOSXGxASh40BWE/Y53dqAoLELzcAAJLWk0ct27at0dHRbpcBAMDA6/oaBAAAkD4EBAAAYCAgAAAAAwEBAAAYCAgAAMBAQAAAAAYCAgAAMBAQAACAgYAAAAAMLZ+k2DyheX5+PrZiAABAsprP7fVuWmg5ICwsLEgKLlQCAAC9ZWFhQcPDw2t+v+XLmhYXFzU7O6stW7YY1zQDAIB08n1fCwsL2rp1qzZsWHulQcsBAQAA9C8WKQIAAAMBAQAAGAgIAADAQEAAAAAGAgIAADAQEAAAgIGAAAAADAQEAABgICAAAAADAQEAABgICAAAwEBAAAAAhv8H3bE6Wv/GmSkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(diabetes_X_test, diabetes_y_test,  color='black')\n",
    "plt.plot(diabetes_X_test, diabetes_y_pred, color='blue', linewidth=3)\n",
    "\n",
    "plt.xticks(())\n",
    "plt.yticks(())\n",
    "\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
